package flc.ast.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.TimeUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.text.SimpleDateFormat;
import java.util.Random;

import flc.ast.R;
import flc.ast.bean.MyLineBean;
import flc.ast.bean.MyProtectionBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class ProtectionRecordAdapter extends StkProviderMultiAdapter<MyProtectionBean> {

    public ProtectionRecordAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(35));
        addItemProvider(new ProtectionRecordProvider());
    }

    private class ProtectionRecordProvider extends BaseItemProvider<MyProtectionBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_protection_record;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyProtectionBean bean) {
            baseViewHolder.setText(R.id.tvProtectionRecordItemName, bean.getName());
            baseViewHolder.setText(R.id.tvProtectionRecordItemDuration, bean.getDuration());
            baseViewHolder.setText(R.id.tvProtectionRecordItemTime, TimeUtils.millis2String(bean.getTime(), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")));
        }
    }
}
